import React, { useState } from "react";
import useChatRoom from "../hooks/useChatRoom";

interface ChatRoomProps {
  roomId: string;
}
const ChatRoom: React.FC<ChatRoomProps> = ({ roomId }) => {
  const [serverUrl, setServerUrl] = useState("https://localhost:1234");

  useChatRoom({ serverUrl, roomId });

  return (
    <>
      <label>
        服务器URL：
        <input value={serverUrl} onChange={e => setServerUrl(e.target.value)} />
      </label>
      <h1>欢迎来到{roomId}房间！</h1>
    </>
  );
};
export default ChatRoom;
